package com.mm.serivce.book;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mm.domain.book.DBookInfo;
import com.mm.domain.book.DBookSource;
import com.mm.util.result.DResult;

import javax.servlet.http.HttpServletResponse;

/**
 * @Description
 * @Date 2023/10/8 下午4:54
 * @Author yanglin
 **/
public interface BookInfoService extends IService<DBookInfo> {

    /**
     * 书籍分页
     *
     * @param page
     * @param limit
     * @param bookTxt
     * @return
     */
    Page<DBookInfo> queryBookInfoPage(Integer page, Integer limit, Integer bookWeb, Integer bookCategory, String bookTxt);

    /**
     * 书籍单个
     *
     * @param bookId
     * @return
     */
    DBookInfo queryBookInfoOne(Long bookId);


    /**
     * 书籍删除
     *
     * @param bookId
     * @return
     */
    boolean removeBookInfo(Long bookId);

    /**
     * 下载所有到本地
     *
     * @return
     */
    void syncAllBook();

    /**
     * 下载单个文件到本地
     *
     * @param bookId
     * @return
     */
    void syncBook(Long bookId);

    /**
     * 网络文件同步下载
     *
     * @param response
     * @param bookId
     */
    void syncDownloadBook(HttpServletResponse response, Long bookId);

    /**
     * 本地文件直接下载
     *
     * @param response
     * @param bookId
     */
    void downloadBook(HttpServletResponse response, Long bookId);

    /**
     * 删除未更新的记录
     */
    void removeNotUpdateBook();
}
